﻿using Md.Api.Entity.DapperModels.MdDB;
using Md.Api.Model.Manage.MdArticle.Request;
using Md.Dapper.Repositories.Md;

namespace Md.Api.Service.Manage.MdArticle;
/// <summary>
/// 分页获取文章列表服务
/// </summary>
public class GetMdArticlePageListService : ApiBase<RequestGetMdArticlePageListModel>
{
    /// <summary>
    /// 文章仓储
    /// </summary>
    public MdArticleRep mdArticleRep { get; set; }
    /// <summary>
    /// 执行
    /// </summary>
    protected override void ExecuteMethod()
    {
        var model = new MdArticleModel();

        model.Title = Parameter.Title;
        model.SubTitle = Parameter.SubTitle;
        model.SeoTitle = Parameter.SeoTitle;
        model.Author = Parameter.Author;
        model.IsExternalLink = Parameter.IsExternalLink;
        model.CategoryId = Parameter.CategoryId;
        model.ArticleType = Parameter.ArticleType;
        model.Status = Parameter.Status;
        model.UpdateBy = Parameter.UpdateBy;
        model.CreateBy = Parameter.CreateBy;

        var res = mdArticleRep.GetMdArticlePageList(model, Parameter.PageIndex, Parameter.PageSize, Parameter.OrderBy, Parameter.IsDesc);

        Result.Data = res;
    }
}

